package com.kun.comfig;

import com.kun.interceptor.LogInterceptor;
import com.kun.interceptor.MemberInterceptor;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @className: SpringMvcConfig
 * @Description: 开启日志拦截器、处理member的拦截器
 * @author: kunkun
 * @date: 2025/7/26 18:02
 */
@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {
    @Autowired
    MemberInterceptor memberInterceptor;

    @Autowired
    LogInterceptor logInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(logInterceptor);
        registry.addInterceptor(memberInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/member/member/hello",
                        "/member/member/login",
                        "/member/member/send-code"
                );
    }
}
